using System;
using System.Xml;

namespace XmlObjects.Parsers
{
	public class XmlParserFactory
	{
		public static XmlParser<T> GetParser<T>()
		{
			return new XmlParser<T>();
		}

		public static IXmlParser GetParserFor(Type t)
		{
			Type theMyClassGenericType = typeof(XmlParser<>).MakeGenericType(t);
			IXmlParser xmlParser = (IXmlParser)Activator.CreateInstance(theMyClassGenericType);
			// do some other stuff;
			return xmlParser;
		}

	}

	public interface IXmlParser
	{
		object GetValue(XmlNode node);
	}

	public class XmlParserAdaptor<T> : XmlParser<T>, IXmlParser where T: class, new()
	{
		object IXmlParser.GetValue(XmlNode node)
		{
			return GetValue(node);
		}
	}

	public class XmlParser<T>
	{
		public T GetValue(XmlNode aNode)
		{
			return default(T);
		}
	}
}